# data_loader.py

import json

def load_data(file_path):
    """加载JSONL格式的数据"""
    texts = []
    labels = []

    with open(file_path, 'r', encoding='utf-8') as f:
        for line in f:
            data = json.loads(line)
            texts.append(data['text'])
            if 'label' in data:
                labels.append(data['label'])

    return texts, labels if labels else None